package top.jianx.music.factory;

import top.jianx.music.api.MusicApi;
import top.jianx.music.enums.MusicProvider;

/**
 * 音乐Api工厂类
 *
 * @author Jianx <jianx70687547@gmail.com>
 * @date 2022/1/16 11:16
 * @since 1.0.0
 */
public class MusicApiFactory {
    /**
     * 创建Api接口的方法
     *
     * @param provider {@linkplain MusicProvider} 音乐类别枚举类
     * @return {@linkplain MusicApi} 音乐Apis
     */
    public static MusicApi create(MusicProvider provider) {
        try {
            return provider.getMusicApiClass().newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            e.printStackTrace();
        }
        return null;
    }
}
